/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.clientapi;

import com.jili.ubert.code.client2server.SimpleDataMsg;
import com.jili.ubert.code.server2client.MsgResult;
import com.jili.ubert.code.server2client.Price;
import com.jili.ubert.dao.db.ObjInfo;
import com.jili.ubert.dao.db.ObjNewStock;
import com.jili.ubert.dao.db.ObjPriceTick;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

/**
 *
 * @author ChengJili
 */
class MarketDataClientHanlder extends SimpleChannelInboundHandler<MsgEntity> {

    private final MarketDataRequest client;

    public MarketDataClientHanlder(MarketDataRequest client) {
        this.client = client;
    }

    @Override
    protected void messageReceived(ChannelHandlerContext ctx, MsgEntity msg) throws Exception {
        if (msg == null) {
            return;
        }
        msg.setChannel(ctx.channel());
        // int playerid = ServerCache.get(ctx.channel());
        int csCommondCode = msg.getCmdCode();
        byte[] data = msg.getData();
        if (csCommondCode == 1) {
            ClientAPI.WorkRun(new Runnable() {

                @Override
                public void run() {
                    client.AccpetSessionAnswer(msg.getSessionID(),msg);
                }
            });
        }
    }

}
/*
 prviate final BlockingQueue<MsgResult> loginAnswer = new LinkedBlockingQueue<>();
 prviate final BlockingQueue<Double> lNCPriceAnswer = new LinkedBlockingQueue<>();
 prviate final BlockingQueue<Price> lastPriceQueueAnswer = new LinkedBlockingQueue<>();
 prviate final BlockingQueue<MsgResult> msgResultAnswer = new LinkedBlockingQueue<>();
 prviate final BlockingQueue<List<ObjInfo>> queryObjListAnswer = new LinkedBlockingQueue<>();
 prviate final BlockingQueue<List<ObjPriceTick>> queryPriceTickAnswer = new LinkedBlockingQueue<>();
 prviate final BlockingQueue<List<ObjNewStock>> queryNewObjListAnswer = new LinkedBlockingQueue<>();

    
 */

